import dotenv
from langchain_community.utilities import GoogleSerperAPIWrapper
from pydantic import BaseModel,Field
from langchain_community.tools import GoogleSerperRun

dotenv.load_dotenv()
class GoogleSerperSchema(BaseModel):
    query:str = Field(description="执行谷歌搜索的查询语句")
    
google_serper = GoogleSerperRun(
    name = "google_serper",
    description = (
        "一个低成本的谷歌搜索工具"
        "当你想要回答有关问题的时候，可以调用该工具"
        "该工具的输入是搜索查询语句"
    ),
    api_wrapper = GoogleSerperAPIWrapper()
)

print(google_serper.invoke("今天黄金的价格"))